<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body,p {margin: 0;}
        ol,ul,li {padding: 0;margin: 0;list-style: none;}
        #wrap {
            width: 1000px;
            user-select: none;
        }
        #wrap ul li {
            height: 50px;
            border-bottom: 1px solid red;
            font-size: 12px;
            padding-left: 20px;
        }
        #wrap ul li p,
        #wrap ul li input,
        #wrap ul li div {
            float: left;
        }
        #wrap ul li p {
            line-height: 50px;
        }
        #wrap ul li p.show {
            display: block;
        }
        #wrap ul li p.hide {
            display: none;
        }
        #wrap ul li input {
            font-size: 12px;
            margin-top: 15px;
            display: none;
        }
        #wrap ul li input.show {
            display: block;
        }
        #wrap ul li input.hide {
            display: none;
        }
        #wrap ul li div {
            width: 50px;
            height: 20px;
            font-size: 12px;
            text-align: center;
            line-height: 20px;
            background-color: #000;
            color: #fff;
            margin: 15px 0 0 20px;
            cursor: pointer;
        }
        #wrap ul li div.show {
            display: block;
        }
        #wrap ul li div.hide {
            display: none;
        }
    </style>
</head>
<body>
    <div id="wrap">
        <ul>
            <li>
                <p>可编辑框</p>
                <input type="text" placeholder="可编辑的框">
                <div class="xiugai show">修改</div>
                <div class="queding hide">确认</div>
            </li>
            <li>
                <p>可编辑框</p>
                <input type="text" placeholder="可编辑的框">
                <div class="xiugai show">修改</div>
                <div class="queding hide">确认</div>
            </li>
            <li>
                <p>可编辑框</p>
                <input type="text" placeholder="可编辑的框">
                <div class="xiugai show">修改</div>
                <div class="queding hide">确认</div>
            </li>
            <li>
                <p>可编辑框</p>
                <input type="text" placeholder="可编辑的框">
                <div class="xiugai show">修改</div>
                <div class="queding hide">确认</div>
            </li>
        </ul>
    </div>

    <script>
        let aP = document.querySelectorAll("#wrap p"),
            aInp = document.querySelectorAll("#wrap input"),
            aXiu = document.querySelectorAll("#wrap .xiugai"),
            aQue = document.querySelectorAll("#wrap .queding");

        let len = aP.length;

        

        //确定按钮点击事件

        for(let i=0;i<len;i++) {
            //修改按钮的点击事件
            aXiu[i].onclick = function() {
                //修改隐藏，确认显示
                this.className = "xiugai hide";
                aQue[i].className = "queding show";

                //p隐藏
                aP[i].className = "hide";

                //input显示
                aInp[i].className = "show";
            }

            //确定按钮的点击事件
            aQue[i].onclick = function() {
                //确定隐藏，修改显示
                this.className = "queding hide";
                aXiu[i].className = "xiugai show";

                //input隐藏
                aInp[i].className = "hide";

                //p显示
                aP[i].className = "show";

                //p的内容应该是input的value
                aP[i].innerHTML = aInp[i].value;
            }
        }
    </script>
</body>
</html>